/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gapktool;
import java.io.File;
import java.io.IOException;
/**
 *
 * @author Administrator
 */
public class ClassToJava {

    public void listFolder(String thisjardir, String path, String codedir, String apkname) {
        File file = new File(path);
        File[] list = file.listFiles();
        for (int i = 0; i < list.length; i++) {
            if (list[i].isDirectory()) {
                listFolder(thisjardir, list[i].getPath(), codedir, apkname);
            }
            if (list[i].getPath().indexOf("$") == -1) {
                Process process = null;
                try {
                    String pathss = "cmd /c " + thisjardir + "\\lib\\jad\\jad.exe -sjava -r -o -d" + codedir + "\\" + apkname + "\\src\\  " + list[i].getPath();
                    if (list[i].getName().equals("R.class")) {
                        process = Runtime.getRuntime().exec("cmd /c " + thisjardir + "\\lib\\jad\\jad.exe -sjava -r -o -d" + codedir + "\\" + apkname + "\\gen\\  " + list[i].getPath());
                    } else {
                        process = Runtime.getRuntime().exec("cmd /c " + thisjardir + "\\lib\\jad\\jad.exe -sjava -r -o -d" + codedir + "\\" + apkname + "\\src\\  " + list[i].getPath());
                    }
                } catch (IOException ex) {
                    System.out.println(ex);
                }
            }
        }
    }

    public void deleteFile(File file) {
        if (file.exists()) {
            if (file.isFile()) {
                file.delete();
            } else if (file.isDirectory()) {
                File files[] = file.listFiles();
                for (int i = 0; i < files.length; i++) {
                    this.deleteFile(files[i]);
                }
            }
            file.delete();
        }
    }
}
